﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using VanTaiProperty;

namespace VanTaiData
{
    public class TMPlan_TransferOrder_Controller : clsConnect
    {
        private clsConnect cls = new clsConnect();
        #region[Get-Data]
        public DataTable BindGridTMPlan_TransferOrder()
        {
            return cls.BindGridData("sp_TMPlan_TransferOrder");
        }
        public DataTable BindGridTMPlan_TransferOrder_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMPlan_TransferOrder_Detail_Edit", "@Id", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMCommandTransferOrde(clsTMPlan_TransferOrderProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DommandTransferOrder_Alias", data.DommandTransferOrder_Alias);
            cls.AddParameter("@DommandTransferOrder_Date", data.DommandTransferOrder_Date);
            cls.AddParameter("@DommandTransferOrder_Mem_ID", data.DommandTransferOrder_Mem_ID);
            cls.AddParameter("@DommandTransferOrder_Vehicle_ID", data.DommandTransferOrder_Vehicle_ID);
            cls.AddParameter("@DommandTransferOrder_Customers_ID", data.DommandTransferOrder_Customers_ID);
            cls.AddParameter("@DommandTransferOrder_Booking_Number", data.DommandTransferOrder_Booking_Number);
            cls.AddParameter("@DommandTransferOrder_Cont_Number", data.DommandTransferOrder_Cont_Number);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_0", data.DommandTransferOrder_Delivery_ID_0);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_1", data.DommandTransferOrder_Delivery_ID_1);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_2", data.DommandTransferOrder_Delivery_ID_2);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_3", data.DommandTransferOrder_Delivery_ID_3);
            cls.AddParameter("@DommandTransferOrder_Delivery_KM_Number", data.DommandTransferOrder_Delivery_KM_Number);
            cls.AddParameter("@DommandTransferOrder_Delivery_Oil_Number", data.DommandTransferOrder_Delivery_Oil_Number);
            cls.AddParameter("@DommandTransferOrder_Request", data.DommandTransferOrder_Request);
            cls.AddParameter("@DommandTransferOrder_Cont_ID", data.DommandTransferOrder_Cont_ID);
            cls.AddParameter("@DommandTransferOrder_Note", data.DommandTransferOrder_Note);
            cls.AddParameter("@DommandTransferOrder_Status_Mem", data.DommandTransferOrder_Status_Mem);
            cls.AddParameter("@DommandTransferOrder_Leadership", data.DommandTransferOrder_Leadership);
            cls.AddParameter("@DommandTransferOrder_Level_1", data.DommandTransferOrder_Level_1);
            cls.AddParameter("@DommandTransferOrder_Level_2", data.DommandTransferOrder_Level_2);
            cls.ExecuteNonQuery("sp_TMPlan_TransferOrder_Insert");
            return true;
        }
        public bool UpdateTMCommandTransferOrde(clsTMPlan_TransferOrderProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DommandTransferOrder_ID", data.DommandTransferOrder_ID);
            cls.AddParameter("@DommandTransferOrder_Alias", data.DommandTransferOrder_Alias);
            cls.AddParameter("@DommandTransferOrder_Date", data.DommandTransferOrder_Date);
            cls.AddParameter("@DommandTransferOrder_Mem_ID", data.DommandTransferOrder_Mem_ID);
            cls.AddParameter("@DommandTransferOrder_Vehicle_ID", data.DommandTransferOrder_Vehicle_ID);
            cls.AddParameter("@DommandTransferOrder_Customers_ID", data.DommandTransferOrder_Customers_ID);
            cls.AddParameter("@DommandTransferOrder_Booking_Number", data.DommandTransferOrder_Booking_Number);
            cls.AddParameter("@DommandTransferOrder_Cont_Number", data.DommandTransferOrder_Cont_Number);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_0", data.DommandTransferOrder_Delivery_ID_0);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_1", data.DommandTransferOrder_Delivery_ID_1);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_2", data.DommandTransferOrder_Delivery_ID_2);
            cls.AddParameter("@DommandTransferOrder_Delivery_ID_3", data.DommandTransferOrder_Delivery_ID_3);
            cls.AddParameter("@DommandTransferOrder_Delivery_KM_Number", data.DommandTransferOrder_Delivery_KM_Number);
            cls.AddParameter("@DommandTransferOrder_Delivery_Oil_Number", data.DommandTransferOrder_Delivery_Oil_Number);
            cls.AddParameter("@DommandTransferOrder_Request", data.DommandTransferOrder_Request);
            cls.AddParameter("@DommandTransferOrder_Cont_ID", data.DommandTransferOrder_Cont_ID);
            cls.AddParameter("@DommandTransferOrder_Note", data.DommandTransferOrder_Note);
            cls.AddParameter("@DommandTransferOrder_Status_Mem", data.DommandTransferOrder_Status_Mem);
            cls.AddParameter("@DommandTransferOrder_Leadership", data.DommandTransferOrder_Leadership);
            cls.AddParameter("@DommandTransferOrder_Level_1", data.DommandTransferOrder_Level_1);
            cls.AddParameter("@DommandTransferOrder_Level_2", data.DommandTransferOrder_Level_2);
            cls.ExecuteNonQuery("sp_TMPlan_TransferOrder_Update");
            return true;
        }
        public bool DeleteTMCommandTransferOrder(int id)
        {
            cls.Delete("sp_TMPlan_TransferOrder_Delete", "@DommandTransferOrder_ID", id);
            return true;
        }
        public bool TranferTMCommandTransferOrder(clsTMPlan_TransferOrderProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Id", data.DommandTransferOrder_ID);
            cls.ExecuteNonQuery("sp_sp_TMPlan_TransferOrder_Transfer");
            return true;
        }
        #endregion

        #region[Search-Fillter]
        public DataTable TMCommandTransferOrde_Fillter_Date(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMPlan_TransferOrder_Fillter_Date", DateBegin, EndBegin);
        }
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMPlan_TransferOrder_Search", "@KEYWORDS", keywords);
        }
        #endregion
    }
}
